package org.starsource.forum.client.domain;

import java.sql.Timestamp;

import org.starsource.forum.client.util.Assertion;
import com.google.gwt.user.client.rpc.IsSerializable;

public class LoginLogObject implements IsSerializable {
	
	private int id;
	
	private UserObject user;

	private String ip;

	private Timestamp timestamp;

	public LoginLogObject() {
		
	}
	
	public LoginLogObject(UserObject user, String ip, Timestamp timestamp) {
		this.user = user;
		this.ip = ip;
		this.timestamp = timestamp;
	}
	
	public LoginLogObject(int id, UserObject user, String ip, Timestamp timestamp) {
		this.id = id;
		this.user = user;
		this.ip = ip;
		this.timestamp = timestamp;
	}
	
	public boolean equals(Object obj) {
		try {
			LoginLogObject object = (LoginLogObject)obj;
			
			if (this.id != object.id) return false;
			
			if (!Assertion.isEqual(this.user, object.user)) return false;
			
			if (!Assertion.isEqual(this.ip, object.ip)) return false;
			
			if (!Assertion.isEqual(this.timestamp, object.timestamp)) return false;

			return true;
		} catch (Exception e) {
			return false;
		}
	}
	
	public String getIp() {
		return ip;
	}

	public void setIp(String ip) {
		this.ip = ip;
	}

	public Timestamp getTimestamp() {
		return timestamp;
	}

	public void setTimestamp(Timestamp timestamp) {
		this.timestamp = timestamp;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public UserObject getUser() {
		return this.user;
	}
	
	public void setUser(UserObject user) {
		this.user = user;
	}

}
